package drds.binlog.binlog_event.event.unimportance;

import drds.binlog.binlog_event.LogByteBlock;
import drds.binlog.binlog_event.event.FormatDescriptionLogEvent;
import drds.binlog.binlog_event.event.IgnorableLogEvent;
import drds.binlog.binlog_event.event.LogHeader;
import drds.binlog.common.Authors;
import drds.common.Author;
import lombok.Getter;
import lombok.Setter;

/**
 * mariadb的GTID_EVENT类型
 */
@Author(name = Authors.LI_YANG)
public class GtidLogEvent extends IgnorableLogEvent
{
    @Setter
    @Getter
    private long gtid;

    /**
     * <pre>
     * mariadb gtidlog event format
     *     uint<8> GTID sequence
     *     uint<4> Replication Domain ID
     *     uint<1> Flags
     *
     * 	if flag & FL_GROUP_COMMIT_ID
     * 	    uint<8> commit_id
     * 	else
     * 	    uint<6> 0
     * </pre>
     */

    public GtidLogEvent(LogHeader logHeader, LogByteBlock logByteBlock, FormatDescriptionLogEvent formatDescriptionLogEvent)
    {
        super(logHeader, logByteBlock, formatDescriptionLogEvent);
        gtid = logByteBlock.getNextLittleEndian8UnsignedLong().longValue();
        // do nothing , just ignore log event
    }


}
